home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
GRAPHICS
/
TS32
/
DIB.INT
< prev
next >
Wrap
Text File
|
1996-03-21
|
3KB
|
102 lines
unit Dib;
(*********************************************
TDIB->TComponent
A non-visual encapsulation of a Windows DIB. The
DIB data is stored in binary format in the form's
DFM file.
Properties
DataLoaded-
Indicates whether or not DIB data is loaded into the TDIB.
You can set this to FALSE to clear DIB data.
DIBCanvas-
An instance of a TDIBCanvas that is owned by this TDIB. Use
this TDIBCanvas to access or modify the DIB data. You can
also obtain the dimensions of the DIB from the TDIBCanvas.
DIBLoadFile-
Setting this property to a valid BMP file will cause the DIB
data from that file to load into the TDIB. The file name
reference is not retained, but the physical DIB data is.
DIBLoadImage-
Setting this property to a TImage control on the form will
cause the DIB data from that TImage to load into the TDIB. The
TImage reference is not retained, but the physical DIB data is.
FramesX,FramesY-
Indicates whether the DIB data is partitioned into segments.
Provide the number of frames along the X and Y axis. TDIBSprite
uses this information when rendering sprites.
NumColors-
The number of colors used by the DIB. Currently only 256 color
DIBs are supported.
Size-
The total size of the DIB data in bytes.
Events
Methods
*********************************************)
interface
uses
SysUtils, Graphics, Windows, Messages, Classes, Controls, Grafix,
Forms, DsgnIntf, MemoryMappedFile, ExtCtrls, DIBCanvas, Dialogs;
type
EDIB = class( Exception );
TDIB = class( TComponent )
private
nDummy: word;
niDummy: integer;
nDummyLong: longint;
pDIBBits: pointer;
FDIBCanvas: TDIBCanvas;
FFileName: TFileName;
FSize: integer;
FFramesX, FFramesY: integer;
FNumColors: word;
FImage: TImage;
procedure CleanUp;
procedure LoadBitmapFile( const s: TFileName );
procedure ReadImage( Stream: TStream );
procedure WriteImage( Stream: TStream );
protected
procedure DefineProperties( Filer: TFiler ); override;
procedure SetFileName( const sName: TFileName );
procedure SetImage( im: TImage );
procedure SetDIBCanvas( dc: TDIBCanvas );
procedure LoadFromBitmap( bm: Graphics.TBitmap );
procedure LoadFromFile( const sName: TFileName );
function GetDataLoaded: boolean;
procedure SetDataLoaded( b: boolean );
public
constructor Create( AOwner: TComponent ); override;
destructor Destroy; override;
published
property DataLoaded: boolean read GetDataLoaded write SetDataLoaded;
property DIBCanvas: TDIBCanvas read FDIBCanvas write SetDIBCanvas;
property DIBLoadFile: TFileName read FFileName write SetFileName;
property FramesX: integer read FFramesX write FFramesX;
property FramesY: integer read FFramesY write FFramesY;
property DIBLoadImage: TImage read FImage write SetImage;
property NumColors: word read FNumColors write nDummy;
property Size: integer read FSize write niDummy;
end;
TDIBFileNameProperty = class( TPropertyEditor )
private
protected
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure SetValue( const Value: string ); override;
end;
procedure Register;